<div class="tabbable tabs-left">
    <ul class="nav nav-tabs">
        <li><h5><?php echo $this->translate('专题信息'); ?></h5></li>
        <li class="active"><a data-toggle="tab" href="#theme_a"><?php echo $this->translate('基本信息'); ?></a></li>
        <li class=""><a data-toggle="tab" href="#theme_c"><?php echo $this->translate('搜索引擎优化'); ?></a></li>
    </ul>
    <form class="form-horizontal" method="post" name="theme_form" id="theme_form">
        <div class="tab-content">
            <div id="sticky_navigation" style="height:30px;border-bottom:4px solid #DFDFDF;">
                <div class="pull-left" style="font-size:16px;line-height:30px;"><strong><?php if($this->theme_info) echo $this->translate('编辑'); else echo $this->translate('新加'); ?><?php echo $this->translate('专题'); ?></strong></div>
                <div id="sticky_navigation_right" class="pull-right">
                    <a href="<?php echo $this->url('admintheme/default'); ?>" class="btn btn-small"><i class="icon-arrow-left"></i> <?php echo $this->translate('返回专题列表'); ?></a>&nbsp;
                    <a href="<?php echo $this->serverUrl(true); ?>" class="btn btn-small btn-warning"><i class="icon-repeat icon-white"></i> <?php echo $this->translate('刷新'); ?></a>&nbsp;
                    <button type="submit" class="btn btn-small btn-primary"><i class="icon-ok icon-white"></i> <?php echo $this->translate('保存专题'); ?></button>&nbsp;
                    <a href="<?php echo $this->myviewalias()->dbshopHelpUrl('theme_set'); ?>" target="_blank" class="btn btn-small btn-info"><i class="icon-info-sign icon-white"></i> <?php echo $this->translate('查看帮助说明'); ?></a>
                </div>
            </div>
            <div id="theme_a" class="tab-pane active">
                <div class="well admin_add_header_well"><?php echo $this->translate('基本信息'); ?></div>
                <div class="well admin_add_well">
                    <div class="message_one">
                    </div>
                    <div class="control-group">
                        <label for="input01" class="control-label"><?php echo $this->translate('专题名称'); ?><span class="must_add_value">*</span>：</label>
                        <div class="controls">
                            <input type="text" id="theme_name"  name="theme_name" value="<?php echo ($this->theme_info ? $this->escapeHtml($this->theme_info->theme_name) : ''); ?>" class="span10">
                        </div>
                    </div>
                    <div class="control-group">
                        <label for="input01" class="control-label"><?php echo $this->translate('专题标记'); ?><span class="must_add_value">*</span>：</label>
                        <div class="controls">
                            <input type="text" id="theme_sign"  name="theme_sign" <?php if($this->theme_info) echo 'readonly'; ?> value="<?php echo ($this->theme_info ? $this->escapeHtml($this->theme_info->theme_sign) : ''); ?>" class="span5">
                        </div>
                    </div>
                    <div class="control-group">
                        <label for="input01" class="control-label"><?php echo $this->translate('专题模板'); ?><span class="must_add_value">*</span>：</label>
                        <div class="controls">
                            <select id="theme_template" name="theme_template" class="span4">
                                <option value=""><?php echo $this->translate('请选择'); ?></option>
                                <?php if(isset($this->theme_template) and !empty($this->theme_template)) {
                                    foreach ($this->theme_template as $key => $value) {
                                ?>
                                <option value="<?php echo $key; ?>" <?php if($this->theme_info and $this->theme_info->theme_template == $key) echo 'selected'; ?>><?php echo $this->escapeHtml($value['name']).'('.$key.')'; ?></option>
                                <?php
                                    }
                                } ?>
                            </select>
                        </div>
                    </div>
                    <div class="control-group">
                        <label for="input01" class="control-label"><?php echo $this->translate('专题状态'); ?><span class="must_add_value">*</span>：</label>
                        <div class="controls">
                            <select id="theme_state" name="theme_state" class="span2">
                                <option value="1" <?php if($this->theme_info and $this->theme_info->theme_state == 1) echo 'selected="selected"'; ?>><?php echo $this->translate('启用'); ?></option>
                                <option value="2" <?php if($this->theme_info and $this->theme_info->theme_state == 2) echo 'selected="selected"'; ?>><?php echo $this->translate('禁用'); ?></option>
                            </select>
                        </div>
                    </div>
                </div>
            </div>

            <div id="theme_c" class="tab-pane">
                <div class="well admin_add_header_well"><?php echo $this->translate('搜索引擎优化'); ?></div>
                <div class="well admin_add_well">
                    <div class="message_one">
                    </div>
                    <div class="control-group">
                        <label for="input01" class="control-label"><?php echo $this->translate('扩展标题'); ?>：</label>
                        <div class="controls">
                            <input type="text" id="theme_extend_name" name="theme_extend_name" value="<?php if($this->theme_info and $this->theme_info->theme_extend_name) echo $this->escapeHtml($this->theme_info->theme_extend_name); ?>" class="span12">
                        </div>
                    </div>
                    <div class="control-group">
                        <label for="input01" class="control-label"><?php echo $this->translate('关键词'); ?>：</label>
                        <div class="controls">
                            <textarea class="span12" rows="1" name="theme_keywords" id="theme_keywords"><?php if($this->theme_info and $this->theme_info->theme_keywords) echo $this->escapeHtml($this->theme_info->theme_keywords); ?></textarea>
                        </div>
                    </div>
                    <div class="control-group">
                        <label for="input01" class="control-label"><?php echo $this->translate('描述'); ?>：</label>
                        <div class="controls">
                            <textarea class="span12" rows="3" name="theme_description" id="theme_description"><?php if($this->theme_info and $this->theme_info->theme_description) echo $this->escapeHtml($this->theme_info->theme_description); ?></textarea>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>

<script>
    $(document).ready(function() {
        $("#theme_form").validate({
            rules: {
                theme_name: {
                    required: true
                },
                <?php if(!$this->theme_info) { ?>
                theme_sign: {
                    required: true,
                    stringCheck: true,
                    remote :{
                        url : '<?php echo $this->url('admintheme/default',array('action'=>'check')); ?>',
                        type : 'post',
                        date : {
                            theme_sign :function(){
                                return $('#theme_sign').val();
                            }
                        }
                    }
                },
                <?php } ?>
                theme_template: {
                    required: true
                }
            },
            messages: {
                theme_name: {
                    required: "<?php echo $this->translate('请输入专题名称！'); ?>"
                },
                <?php if(!$this->theme_info) { ?>
                theme_sign: {
                    required: "<?php echo $this->translate('请输入专题标记！'); ?>",
                    stringCheck: "<?php echo $this->translate('必须为字符串！'); ?>",
                    remote: "<?php echo $this->translate('该标记已经存在！'); ?>"
                },
                <?php } ?>
                theme_template: {
                    required: "<?php echo $this->translate('请选择专题模板！'); ?>"
                }
            }
        });
    });
</script>
